package objects.cicleItem
{
	import flash.events.Event;
	import flash.geom.Point;
	import objects.MyObject;
	import starling.display.Image;
	import starling.display.MovieClip;
	import starling.display.Sprite;
	import starling.events.Event;
	import starling.events.Touch;
	import starling.events.TouchEvent;
	import starling.events.TouchPhase;
	import starling.filters.BlurFilter;
	import starling.filters.ColorMatrixFilter;
	import com.greensock.TweenLite;
	import com.greensock.*;
	import com.greensock.easing.*;
	import starling.text.TextField;
	
	/**
	 * ...
	 * @author
	 */
	public class Cicle_Item extends MyObject
	{
		public var m_baseItem:Array;
		public var m_result:int;
		public var m_sprite:Sprite;
		public var m_testSetInfo:Boolean;
		public var colorMatrixFilter:ColorMatrixFilter;
		
		
		public function Cicle_Item(_sprite:Sprite, _pos:Point)
		{
			m_pos = _pos;
			m_sprite = _sprite;
		}
		
		public function blurFilter(_pointTouch:Point):void
		{
			for (var i:int = 0; i < m_baseItem.length; i++)
			{
				if (m_baseItem[i].bounds.containsPoint(_pointTouch) == true &&m_baseItem[i].alpha==1)
				{
					
					if (m_baseItem[i].m_enabled == true)
					{
						m_baseItem[i].filter = BlurFilter.createDropShadow(0, 0, 0xff0000, 1, 1, 0.5);
					}
					m_baseItem[i].m_info.visible = true;
					m_sprite.setChildIndex(m_baseItem[i].m_info, m_sprite.numChildren);
					m_sprite.parent.setChildIndex(m_sprite, m_sprite.parent.numChildren);
				}
				else
				{
					if(m_baseItem[i].bounds.containsPoint(_pointTouch) != true &&m_baseItem[i].alpha==1&&m_baseItem[i].m_enabled == true)
					m_baseItem[i].filter = null;
					m_baseItem[i].m_info.visible = false;
				}
			}
		}
		override public function update(dt:Number):void
		{

		}
		public function clockItem(_index:int):void
		{

		}
		public function unClockItem(_index:int):void
		{
			
		}
		public function showCoint(coint:int):void
		{
			for (var i:int = 0; i < m_baseItem.length; i++)
			{
				m_baseItem[i].showCoint(coint);
			}
		}
		public function clockAndUnclock():void
		{

		}
		public function returnResult(_pointTouch:Point):void
		{
			for (var i:int = 0; i < m_baseItem.length; i++)
			{
				if (m_baseItem[i].bounds.containsPoint(_pointTouch) == true && m_baseItem[i].alpha == 1&&m_baseItem[i].m_enabled==true)
				{
					m_result = i + 1;
					return;
				}
			}						
			for (i = 0; i <m_baseItem.length; i++)
			{
				if (m_baseItem[i].bounds.containsPoint(_pointTouch) == true && m_baseItem[i].alpha == 1&&m_baseItem[i].m_enabled==false)
				{
					m_result = -1;
					return;
				}
			}
			m_result = 0;

		}
		
		public function alphaUp():void
		{
			if (m_spriteMovie.alpha < 1)
			{
				m_spriteMovie.alpha += 0.5;
				for (var i:int = 0; i < m_baseItem.length; i++)
				{
					m_baseItem[i].alpha += 0.5;
				}
			}
		}
		
		public function alphaDown():void
		{
			m_spriteMovie.alpha = 0;
			for (var i:int = 0; i < m_baseItem.length; i++)
			{
				m_baseItem[i].alpha = 0;
			}
		}
		public function setAnchorPoint():void
		{
			m_spriteMovie.pivotX = m_spriteMovie.width / 2;
			m_spriteMovie.pivotY = m_spriteMovie.height / 2;
			
			for (var i:int = 0; i < m_baseItem.length; i++)
			{
				m_baseItem[i].pivotX = m_baseItem[i].width / 2;
				m_baseItem[i].pivotY = m_baseItem[i].height / 2;
			}
		}
		
		public function setScale(_scale:Number):void
		{
			m_spriteMovie.scaleX = _scale;
			m_spriteMovie.scaleY = _scale;
			
			for (var i:int = 0; i < m_baseItem.length; i++)
			{
				m_baseItem[i].scaleX = _scale;
				m_baseItem[i].scaleY = _scale;
			}
		
		}
	}

}